package cn.test.demo.mybatis_demo.controller;

import cn.test.demo.mybatis_demo.dao.ConnectTestDao;
import cn.test.demo.mybatis_demo.entity.ConnectTest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 王杨帅
 * @create 2018-04-13 14:01
 * @desc 测试连接控制层
 **/
@RestController
@RequestMapping(value = "/connectTest")
@Slf4j
public class ConnectTestController {
    @Autowired
    private ConnectTestDao connectTestDao;

    @GetMapping(value = "/readList")
    public List<ConnectTest> readList() {
        List<ConnectTest> connectTestList = connectTestDao.findAll();
        log.info("===获取到的数据为：{}", connectTestList.toArray());
        return connectTestList;
    }

}

